<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>聊天室列表</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary-color: #4361ee;
            --secondary-color: #3f37c9;
            --accent-color: #4895ef;
            --light-color: #f8f9fa;
            --dark-color: #212529;
            --success-color: #4cc9f0;
            --danger-color: #f72585;
            --gray-color: #6c757d;
            --border-radius: 12px;
            --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
            padding: 40px 20px;
            color: var(--dark-color);
            line-height: 1.6;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            border-radius: var(--border-radius);
            box-shadow: var(--box-shadow);
            padding: 40px;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        h1 {
            text-align: center;
            margin-bottom: 40px;
            color: var(--primary-color);
            font-size: 2.5rem;
            font-weight: 700;
            position: relative;
            padding-bottom: 15px;
        }

        h1::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 80px;
            height: 4px;
            background: var(--accent-color);
            border-radius: 2px;
        }

        .room-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 25px;
            margin-bottom: 40px;
        }

        .room-card {
            background: white;
            border-radius: var(--border-radius);
            padding: 25px;
            text-align: center;
            transition: var(--transition);
            cursor: pointer;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
            border: 1px solid rgba(0, 0, 0, 0.05);
            position: relative;
            overflow: hidden;
        }

        .room-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 5px;
            background: var(--primary-color);
        }

        .room-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }

        .room-icon {
            font-size: 2.5rem;
            color: var(--primary-color);
            margin-bottom: 15px;
            transition: var(--transition);
        }

        .room-card:hover .room-icon {
            transform: scale(1.1);
            color: var(--accent-color);
        }

        .room-card h3 {
            color: var(--dark-color);
            margin-bottom: 10px;
            font-size: 1.4rem;
        }

        .room-card p {
            color: var(--gray-color);
            font-size: 0.95rem;
        }

        .home-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin: 20px auto 0;
            padding: 12px 24px;
            background: var(--primary-color);
            color: white;
            text-decoration: none;
            border-radius: 50px;
            transition: var(--transition);
            font-weight: 500;
            box-shadow: 0 4px 6px rgba(67, 97, 238, 0.2);
            border: none;
            cursor: pointer;
        }

        .home-btn:hover {
            background: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(67, 97, 238, 0.3);
        }

        .home-btn i {
            margin-right: 8px;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                padding: 25px;
            }

            h1 {
                font-size: 2rem;
            }

            .room-list {
                grid-template-columns: 1fr;
            }
        }

        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .room-card {
            animation: fadeIn 0.5s ease forwards;
            opacity: 0;
        }

        .room-card:nth-child(1) { animation-delay: 0.1s; }
        .room-card:nth-child(2) { animation-delay: 0.2s; }
        .room-card:nth-child(3) { animation-delay: 0.3s; }
        .room-card:nth-child(4) { animation-delay: 0.4s; }
        .room-card:nth-child(5) { animation-delay: 0.5s; }
        .room-card:nth-child(6) { animation-delay: 0.6s; }
        .room-card:nth-child(7) { animation-delay: 0.7s; }
        .room-card:nth-child(8) { animation-delay: 0.8s; }
        .room-card:nth-child(9) { animation-delay: 0.9s; }
        .room-card:nth-child(10) { animation-delay: 1s; }
    </style>
</head>
<body>
<div class="container">
    <h1><i class="fas fa-comments"></i> 聊天室列表</h1>

    <div class="room-list">
        <!-- 动态生成10个聊天室卡片 -->
    </div>

    <a href="/static/index.html" class="home-btn"><i class="fas fa-home"></i> 返回首页</a>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        const roomList = document.querySelector('.room-list');
        const roomColors = [
            '#4361ee', '#3f37c9', '#4895ef', '#4cc9f0', '#f72585',
            '#b5179e', '#560bad', '#7209b7', '#3a0ca3', '#480ca8'
        ];

        // 开发者可在此处自定义每个聊天室的名称
        const customRoomNames = {
            1: "技术讨论",
            2: "休闲娱乐",
            3: "学习交流",
            4: "游戏天地",
            5: "音乐分享",
            6: "电影电视",
            7: "体育运动",
            8: "美食厨房",
            9: "旅行摄影",
            10: "创业投资"
        };

        // 创建10个聊天室卡片
        for (let i = 1; i <= 10; i++) {
            const roomCard = document.createElement('div');
            roomCard.className = 'room-card';
            roomCard.onclick = function() {
                location.href = `room/room${i}.html`;
            };

            // 为每个卡片设置不同的顶部边框颜色
            roomCard.style.setProperty('--primary-color', roomColors[i-1]);

            // 使用自定义名称或默认名称
            const roomName = customRoomNames[i] || `聊天室 ${i}`;

            roomCard.innerHTML = `
                <div class="room-icon"><i class="fas fa-comment-dots"></i></div>
                <h3>${roomName}</h3>
                <p>点击进入与大家交流</p>
            `;

            roomList.appendChild(roomCard);
        }
    });
</script>
</body>
</html>